function bubbleSort(arr) {
    let length = arr.length
    for (let i = 0; i < length; i++) {
        for (let j = 0; j < length - i - 1; j++) {
            if (arr[i] > arr[i + 1]) {
                let count = arr[i]
                arr[i] = arr[i + 1]
                arr[i + 1] = count
            }
        }
    }
    return arr
}
let test = [1, 6, 3, 2, 7, 22, 6, 8, 9, 10, 16]
console.log(bubbleSort(test));